package com.backend.modules.system.controller;

import com.backend.common.model.R;
import com.backend.modules.system.dto.LoginDTO;
import com.backend.modules.system.dto.RegisterDTO;
import com.backend.modules.system.service.SysUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "认证管理", description = "认证相关接口")
@RestController
@RequestMapping("/v1/auth")
@RequiredArgsConstructor
public class AuthController {

    private final SysUserService userService;

    @Operation(summary = "用户登录")
    @PostMapping("/login")
    public R<String> login(@Validated @RequestBody LoginDTO loginDTO) {
        String token = userService.login(loginDTO);
        return R.ok(token);
    }

//    @Operation(summary = "用户注册")
//    @PostMapping("/register")
//    public R<Void> register(@Validated @RequestBody RegisterDTO registerDTO) {
//        userService.register(registerDTO);
//        return R.ok();
//    }
} 